Generally, the entire string is used as the operation object, for example: search for a substring in a substring, obtain a substring, insert a substring at a certain position in the substring, and delete a substring.
Generally, the entire string is
Generally, the entire string is used as the operation object, for example: search for a substring in a substring, obtain a substring, insert a substring at a certain position in the substring, and delete a substring. The required and sufficient
The commonly used string truncation functions in mysql include substring and SUBSTRING_INDEX. substring is the string whose pos starts to be len. This is a bit like the php string truncation function, let's take a look.
Usage:
SUBSTRING (str, pos,
Usage of Mysql string truncation function SUBSTRING description bitsCN.com feels that MySQL string function truncation characters are more powerful than program interception (such as PHP or JAVA), so here is a record, I hope it will be useful to you.
When creating the view today, it is very convenient to use string Truncation in MySQL.
When creating the view today, it is very convenient to use string Truncation in MySQL.
I feel that the string function of MySQL intercepts characters, which is
MySQL string intercept function: Left (), right (), substring (), Substring_index (). There is also mid (), substr (). where mid (), substr () is equivalent to the substring () function, the function of substring () is very powerful and flexible.1.
Usage:
SUBSTRING (Str,pos,len)SUBSTRING (str from POS for Len)SUBSTRING (Str,pos)SUBSTRING (str from POS)
Alias Substr
Intercept string str String that starts at the beginning of the POS length of Len, if you do not set the Len parameter to get
String function string comparison function if the result length is greater than the maximum value of the max_allowed_packet system variable, the return value of the string value function is NULL. See section 7.5.2 "Adjust server Parameters ".
String
I feel that the string function of MySQL intercepts characters, which is more powerful than program interceptions (such as PHP or JAVA). So I want to make a record here and hope it will be useful to everyone.Function:1. Extract strings from the left
1. Intercept string from left
Left (str, length)
Description: Left (intercepted field, intercept length)
Example: Select Left (content,200) as abstract from my_content_t
2, from the right start to intercept the string
Right (str, length)
Description:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.